package com.yurui;

import com.yurui.anno.ComponentBean;
import com.yurui.anno.event.Demo1Event;
import com.yurui.anno.event.Demo2Event;
import com.yurui.anno.event.MyEventPublisher;
import com.yurui.anno.filter.MyFilter;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class AnnoMain {

    public static void main(String[] args) {

        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
//        context.scan("com.yurui.anno");
        context.refresh();
        ComponentBean calculate = context.getBean(ComponentBean.class);
        calculate.say();

        System.out.println(context.getBean(MyFilter.class));

        MyEventPublisher publisher = context.getBean(MyEventPublisher.class);
        publisher.publishEvent(new Demo1Event("1","demo1"));
        publisher.publishEvent(new Demo2Event("2","demo2"));
    }
}
